package com.free.web;

import com.free.common.entity.ServiceInstance;
import com.free.container.RegisterContainer;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.HashSet;
import java.util.Map;

@Controller
@RequiredArgsConstructor
public class IndexController {

    private final RegisterContainer registerContainer;

    /**
     * 查询当前注册服务信息
     */
    @GetMapping("/")
    public String index(Model model) {
        Map<String, HashSet<ServiceInstance>> mapAddress = registerContainer.getMapAddres();
        model.addAttribute("mapAddress", mapAddress);
        return "index";
    }
}
